Skip to content

Add segregated free-list heap allocator - #152

Merged
wojciechozga merged 2 commits into
IBM:heap_allocfrom
michaeljechow:heap-segregated
Nov 25, 2026
Merged

wojciechozga merged 2 commits into
IBM:heap_allocfrom
michaeljechow:heap-segregated

Conversation

@michaeljechow

Copy link
Copy Markdown

Description of the changes

Adds a segregated free-list heap allocator implementation as an alternative to the linked-list allocator.

  • init_heap now takes an end pointer instead of the heap size and returns a Result
  • both allocators use a generalized interface (empty(), add_memory_region(start, end)) to enable easier switching between implementations
  • SegregatedAllocator has fixed size classes and uses intrusive free-lists per size class. A bump allocator is used to get new memory for a specific class. No coalescing or splitting of existing allocations is allowed.
  • The LinkedList allocator is still used by default.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Formal verification
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Refactorization (non-breaking change which improves code quality)

Michael Jechow added 2 commits November 25, 2026 18:16
Signed-off-by: Michael Jechow <michael.git@jechow.dev>
Signed-off-by: Michael Jechow <michael.git@jechow.dev>
@wojciechozga
wojciechozga merged commit 384a4c2 into IBM:heap_alloc Nov 25, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants